var uploadPage;
$(function () {
    uploadPage = function () {
        this.init();
    };

    uploadPage.prototype = {
        init: function () {
            this.initHtml();
            this.bindEvent();
        },
        initHtml: function () {
            var html = [];
            html.push('<div id="uploadMask" style="display:none;" class="dingwei dingwei1">');
            html.push('<div class="sctxbg">');
            html.push('<div class="paizhaobg">');
            html.push('<p id="uploadFromCamera" class="mbbottom paizhao">拍照</p>');
            html.push('<p id="uploadFromAlbums" class="paizhao">从相册中选择</p>');
            html.push('</div>');
            html.push('<div class="paizhaobg mtop10">');
            html.push('<p id="cloaseUploadMask" class="paizhao">取消</p>');
            html.push('</div>');
            html.push('</div>');
            html.push('</div>');
            $('#main').after(html.join(''));
        },
        bindEvent: function () {

            //取消
            $("#cloaseUploadMask").on("tap", function () {
                $("#uploadMask").hide();
            });

            //从文件中选择
            $("#uploadFromAlbums").on("tap", function (e) {
                this.imagesSelected(e.dataTransfer.files);
                e.stopPropagation();
                e.preventDefault();
            });

        },
        imagesSelected: function (myFiles) {
            alert(myFiles.length);
        },
        show: function () {
            $("#uploadMask").show();
        },
        hide: function () {
            $("#uploadMask").hide();
        },

    }
});
